using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StateMachine<T> where T : State
{
    public T currentState;
    private bool canChange = true;

    public void Initialize(T state)
    {
        currentState = state;
        currentState.Enter();
    }

    public void ChangeState(T state)
    {
        if (canChange)
        {
            currentState.Exit();
            currentState = state;
            currentState.Enter();
        }
    }

    public void BanChange(bool ban)
    { 
       canChange = !ban;
    }
}
